<div class="blazorise-codeblock">
<div class="html"><pre>
<span class="htmlTagDelimiter">&lt;</span><span class="htmlElementName">Button</span> <span class="htmlAttributeName">Clicked</span><span class="htmlOperator">=</span><span class="quot">&quot;</span><span class="htmlAttributeValue"><span class="atSign">&#64;</span>(()=&gt;OnThemeColorChanged(&quot;#d16f9e&quot;))</span><span class="quot">&quot;</span><span class="htmlTagDelimiter">&gt;</span>Change theme<span class="htmlTagDelimiter">&lt;/</span><span class="htmlElementName">Button</span><span class="htmlTagDelimiter">&gt;</span>
</pre></div>
<div class="csharp"><pre>
<span class="atSign">&#64;</span>code{
    Task OnThemeColorChanged( <span class="keyword">string</span> value )
    {
        <span class="keyword">if</span> ( Theme?.ColorOptions != <span class="keyword">null</span> )
            Theme.ColorOptions.Primary = value;

        <span class="keyword">if</span> ( Theme?.BackgroundOptions != <span class="keyword">null</span> )
            Theme.BackgroundOptions.Primary = value;

        Theme.ThemeHasChanged();

        <span class="keyword">return</span> Task.CompletedTask;
    }

    [CascadingParameter] Theme Theme { <span class="keyword">get</span>; <span class="keyword">set</span>; }
}
</pre></div>
</div>
